package com.song.oa.exception;

import com.song.oa.entity.R;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author 宋伟宁
 * @Date 2024/3/20
 * @Version 1.0
 **/
@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(value = UsernameNotFoundException.class)
    public R exceptionHandler(Exception e) {

        return new R(400, e.getMessage());
    }
}
